package com.zzsxy.design.adapter;

import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

//适配器设计模式
public class AdaptText1 {
    public static void main(String[] args) {
        JFrame frame = new JFrame("适配器设计模式");
        frame.setSize(500,500);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setLayout(null);

        JButton button = new JButton("适配器设计模式");
        button.setBounds(50,50,200,100);
        frame.getContentPane().add(button);

        button.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                System.out.println("我点击了......适配器设计模式");
            }
        });

        frame.setVisible(true);
    }


}
